export const addSchema: FormSchema = {
    "style": {
        "width": "auto"
    },
    "formItemLayout": {
        "labelCol": {
            "span": 8
        },
        "wrapperCol": {
            "span": 16
        }
    },
    "watchKeys": [ // 需要监听字段，值为string数组
        "maxtime", "mintime"
    ],
    "watchCallback": (watchKeys, {dynamicForm, modelRef}) => { // watchKeys监听的字段对应的值变化后执行的回调
        const {maxtime, mintime} = modelRef
        console.log(watchKeys, 'watchKeys')
        console.log(dynamicForm, 'dynamicForm表单所有的属性，与后端返回的JSON格式一致， 类型：object')
        console.log(modelRef, 'modelRef表单中所有的字段和值，类型：object')
        if (mintime < maxtime) {
            modelRef.mintime = Math.min(mintime, maxtime)
        }
        if (maxtime <= mintime) {
            modelRef.maxtime = modelRef.mintime
        }
        // 最短期限不能大于最长期限
        // if (min >= 0){
        //     modelRef.mintime = min
        // }
    },
    "formItem": [
        {
            "type": "inputNumber",
            "label": "策略编号",
            "key": "cipherno",
            "value": undefined,
            "props": {
                "min": 0,
                "placeholder": "策略编号"
            },
            "rules": [
                {
                    "required": true,
                    "message": "策略编号不能为空"
                }
            ]
        },
        {
            "type": "input",
            "label": "策略名称",
            "key": "name",
            "value": "",
            "props": {
                "placeholder": "策略名称"
            },
            "rules": [
                {
                    "required": true,
                    "message": "策略名称不能为空"
                }
            ]
        },
        {
            "type": "select",
            "label": "必须使用复杂密码",
            "key": "complicated",
            "value": 0,
            "options": [
                {
                    "value": 0,
                    "label": "否"
                },
                {
                    "value": 1,
                    "label": "是"
                }
            ]
        },
        {
            "type": "inputNumber",
            "label": "密码长度最小值(字符)",
            "key": "minlength",
            "value": 0,
            "props": {
                "min": 0,
                "max": 14,
                "placeholder": "密码长度介于0 和 14 个字符之间!"
            },
            "rules": [
                {
                    "required": true,
                    "message": "密码长度不能为空"
                },
                {
                    "type": "number",
                    "min": 0,
                    "max": 14,
                    "message": "密码长度介于0 和 14 个字符之间!"
                },
            ]
        },
        {
            "type": "inputNumber",
            "label": "密码最短使用期(天)",
            "tips": "密码最短使用期限必须小于密码最长使用期限,，如果长使用期限设置为 0，不受限制!",
            "key": "mintime",
            "value": 0,
            "props": {
                "min": 0,
                "max": 998,
                "placeholder": "密码最短使用期限介于 0 和 998 天之间!"
            },
            "rules": [
                {
                    "required": true,
                    "message": "密码最短使用期限不能为空"
                },
                {
                    "type": "number",
                    "min": 0,
                    "max": 998,
                    "message": "密码最短使用期限介于 0 和 998 天之间!"
                },
            ]
        },
        {
            "type": "inputNumber",
            "label": "密码最长使用期限(天)",
            "key": "maxtime",
            "value": 0,
            "props": {
                "min": 0,
                "max": 998,
                "placeholder": "密码最长使用期限介于 0 和 998 天之间!"
            },
            "rules": [
                {
                    "required": true,
                    "message": "密码最长使用期限不能为空"
                },
                {
                    "type": "number",
                    "min": 0,
                    "max": 998,
                    "message": "密码最长使用期限介于 0 和 998 天之间!"
                },
            ]
        }
    ]
}
